package com.file.system.controller.system;


import cn.hutool.core.util.IdUtil;
import com.file.system.entity.res.CommonResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 系統id
 *
 * @author jch
 */
@RestController
@Validated
@RequestMapping("/id")
public class WebIdController {

    /**
     * 获取id
     */
    @PostMapping("/get")
    public CommonResult<Long> select() {
        // 调用IdUtil的getSnowflakeNextId()方法获取下一个id
        return CommonResult.ok().setResult(IdUtil.getSnowflakeNextId());
    }

}

